<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<ul id="user-menu-tree">
</ul>

<script type="text/javascript">
    $(function () {
        $.ajax({
            url: '<%=request.getContextPath()%>/user.html?act=user_menu&userId=${param.userId}',
            method: "post",
            success: function (result) {
                $("#user-menu-tree").tree({
                    url: '<%=request.getContextPath()%>/user.html?act=menu_tree',
                    checkbox: true,
                    onLoadSuccess: function (node, data) {
                        for (var i = 0; i < result.length; i++) {
                            var node = $('#user-menu-tree').tree('find', result[i]);
                            if( $('#user-menu-tree').tree("isLeaf",node.target)){
                                $('#user-menu-tree').tree('check', node.target);
                            }

                        }
                    }
                })
            }
        })

    });
</script>